package com.gzk.oeno.tech.ui.listedit;

import javax.swing.JPanel;

import com.gzk.utils.CustomException;

public abstract class SingleEditionPane<T> extends JPanel {

	protected T original;
	
	public SingleEditionPane(){
		super();
		// For reflection
	}
	
	public void displayObject(T object, boolean isEditing){
		this.original = object;
		if (isEditing)
			formatForEditing(object);
		else
			formatForDisplay(object);
	}
	
	protected abstract void formatForDisplay(T object);

	protected abstract void formatForEditing(T object);

	public abstract T getEditedObject();

	public abstract void validateObject() throws CustomException;
}